 package handling.channel.handler;

 import client.MapleCharacter;
 import client.MapleClient;
 import client.skills.Skill;
 import client.skills.SkillEntry;
 import client.skills.SkillFactory;
 import constants.JobConstants;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import tools.MaplePacketCreator;
 import tools.data.input.LittleEndianAccessor;













 public class PhantomMemorySkill
 {
   public static void MemorySkillChoose(LittleEndianAccessor slea, MapleClient c) {
/*  30 */     if (c.getPlayer() == null || c.getPlayer().getMap() == null || !JobConstants.is幻影(c.getPlayer().getJob())) {
/*  31 */       c.announce(MaplePacketCreator.enableActions());
       return;
     }
/*  34 */     int skillId = slea.readInt();
/*  35 */     Skill skill = SkillFactory.getSkill(skillId);
/*  36 */     if (skill == null) {
/*  37 */       c.announce(MaplePacketCreator.enableActions());
       return;
     }
/*  40 */     int teachId = slea.readInt();
/*  41 */     Skill theskill = SkillFactory.getSkill(teachId);
/*  42 */     if (theskill == null && teachId != 0) {
/*  43 */       c.announce(MaplePacketCreator.enableActions());
       return;
     }
/*  46 */     if (c.getPlayer().getSkillLevel(skillId) > 0) {
/*  47 */       c.getPlayer().修改幻影装备技能(skillId, teachId);
     }
/*  49 */     c.announce(MaplePacketCreator.enableActions());
   }


   public static void MemorySkillChange(LittleEndianAccessor slea, MapleClient c) {
     MapleCharacter target;
     Skill skill;
/*  56 */     if (c.getPlayer() == null || c.getPlayer().getMap() == null || !JobConstants.is幻影(c.getPlayer().getJob())) {
/*  57 */       c.announce(MaplePacketCreator.enableActions());
       return;
     }
/*  60 */     int skillId = slea.readInt();
/*  61 */     int targetId = slea.readInt();
/*  62 */     byte type = slea.readByte();
/*  63 */     switch (type) {
       case 0:
/*  65 */         target = c.getChannelServer().getPlayerStorage().getCharacterById(targetId);
/*  66 */         if (target != null && target.getSkillLevel(skillId) > 0) {
/*  67 */           int skillBook = SkillFactory.getIdFromSkillId(skillId);
/*  68 */           if (skillBook > 0) {
/*  69 */             c.getPlayer().幻影技能复制(skillBook, skillId, target.getSkillLevel(skillId)); break;
           }
/*  71 */           c.getPlayer().dropMessage(1, "复制技能出现错误");
           break;
         }
/*  74 */         c.announce(MaplePacketCreator.幻影复制错误());
         break;

       case 1:
/*  78 */         c.getPlayer().幻影删除技能(skillId);
/*  79 */         skill = SkillFactory.getSkill(skillId);
/*  80 */         if (skill != null && skill.isBuffSkill()) {
/*  81 */           c.getPlayer().cancelEffect(skill.getEffect(1), false, -1L);
         }
         break;
     }

/*  86 */     c.announce(MaplePacketCreator.enableActions());
   }




   public static void MemorySkillObtain(LittleEndianAccessor slea, MapleClient c) {
/*  93 */     if (c.getPlayer() == null || c.getPlayer().getMap() == null || !JobConstants.is幻影(c.getPlayer().getJob())) {
/*  94 */       c.announce(MaplePacketCreator.enableActions());
       return;
     }
/*  97 */     MapleCharacter target = c.getChannelServer().getPlayerStorage().getCharacterById(slea.readInt());
/*  98 */     if (target != null) {
/*  99 */       List<Integer> memorySkills = new LinkedList<>();
/* 100 */       Map<Integer, SkillEntry> skills = target.getSkills();
/* 101 */       for (Map.Entry<Integer, SkillEntry> skill : skills.entrySet()) {
/* 102 */         if (SkillFactory.isMemorySkill(((Integer)skill.getKey()).intValue()) && target.getSkillLevel(((Integer)skill.getKey()).intValue()) > 0) {
/* 103 */           memorySkills.add(skill.getKey());
         }
       }
/* 106 */       if (!memorySkills.isEmpty()) {
/* 107 */         c.announce(MaplePacketCreator.封印之瞳(target, memorySkills));
       }
     }
/* 110 */     c.announce(MaplePacketCreator.enableActions());
   }
 }


/* Location:              C:\PGX\Server.jar!\handling\channel\handler\PhantomMemorySkill.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */